<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Generazione sequenze: Riferimenti per il file fileIO.cc</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Generazione sequenze
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generato da Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Cerca');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Pagina&#160;Principale</span></a></li>
      <li><a href="annotated.html"><span>Classi</span></a></li>
      <li class="current"><a href="files.html"><span>File</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Cerca" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Elenco&#160;dei&#160;file</span></a></li>
      <li><a href="globals.html"><span>Elementi&#160;dei&#160;file</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#func-members">Funzioni</a>  </div>
  <div class="headertitle">
<div class="title">Riferimenti per il file fileIO.cc</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="strutt__dati_8h_source.html">strutt_dati.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="manip__stampa_8h_source.html">manip_stampa.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="fileIO_8h_source.html">fileIO.h</a>&quot;</code><br/>
<code>#include &lt;sstream&gt;</code><br/>
</div><table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Funzioni</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="fileIO_8cc.html#a32b85d9151974c75590269537470fc55">salva</a> (const <a class="el" href="structdesc__sequenza.html">desc_sequenza</a> &amp;s, const char nome[])</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="fileIO_8cc.html#ab61cddedaf10e1ea1d096eaccaa7e04f">carica</a> (<a class="el" href="structdesc__sequenza.html">desc_sequenza</a> &amp;seq, const char nome[])</td></tr>
</table>
<hr/><h2>Documentazione delle funzioni</h2>
<a class="anchor" id="ab61cddedaf10e1ea1d096eaccaa7e04f"></a><!-- doxytag: member="fileIO.cc::carica" ref="ab61cddedaf10e1ea1d096eaccaa7e04f" args="(desc_sequenza &amp;seq, const char nome[])" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="fileIO_8h.html#aba08b7ce9048d097199252f8a1caf12e">carica</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structdesc__sequenza.html">desc_sequenza</a> &amp;&#160;</td>
          <td class="paramname"><em>seq</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char&#160;</td>
          <td class="paramname"><em>nome</em>[]&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<div class="fragment"><pre class="fragment">{
    <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> MAXLINE = <a class="code" href="strutt__dati_8h.html#ae68bf5715a32605dee2ba5beeb81fd66">MAXLUN</a> * 100 ;
    ifstream f(nome) ;
    <span class="keywordflow">if</span> (!f) {
        cerr&lt;&lt;<span class="stringliteral">&quot;Errore nel caricamento del file &quot;</span>&lt;&lt;nome&lt;&lt;endl ;
        <span class="keywordflow">return</span> false ;
    }

    <span class="comment">// eliminiamo l&#39;eventuale precedente sequenza per evitare memory leak</span>
    <a class="code" href="manip__stampa_8cc.html#a5e79aa45e1756e1da685e0deb903d733">distruggi</a>(seq) ;
    <a class="code" href="manip__stampa_8cc.html#a98c57942b3eab58c3171251f86b46a97" title="Inizializzazione di una sequenza.">inizializza</a>(seq, seq.<a class="code" href="structdesc__sequenza.html#ad78b62173c851d3a4a71065fd9581b78">tipo_chiave</a>) ; <span class="comment">// fondamentale per</span>
                                        <span class="comment">// riutilizzare la sequenza</span>
                                        <span class="comment">// dopo la distruggi !!!</span>

    <span class="keywordtype">char</span> buf[MAXLINE + 1] ;
    <span class="keywordflow">while</span> (f.getline(buf, MAXLINE)) {
        istringstream s(buf) ;
        <a class="code" href="structelem.html">elem</a> *el = <a class="code" href="manip__stampa_8cc.html#a56e89b854e36fe1951ebd4679e3820b1">crea_elem</a>(s) ;
        <span class="keywordflow">if</span> (el == 0) {
            cout&lt;&lt;<span class="stringliteral">&quot;Creazione nuovo elemento fallita, caricamento interrotto&quot;</span>
                &lt;&lt;endl ;
            <span class="keywordflow">return</span> false ;
        }
        <a class="code" href="manip__stampa_8cc.html#aaf29bed7640205c32dbca4c882027e43">inserisci</a>(seq, el, <a class="code" href="strutt__dati_8h.html#aded7eef211a32e3755ae48de409c1c54a5ac8b47dd381ed0c2808561e0a4aec98">in_coda</a>) ;
    }
    <span class="keywordflow">return</span> true ;
}
</pre></div>
</div>
</div>
<a class="anchor" id="a32b85d9151974c75590269537470fc55"></a><!-- doxytag: member="fileIO.cc::salva" ref="a32b85d9151974c75590269537470fc55" args="(const desc_sequenza &amp;s, const char nome[])" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="fileIO_8h.html#a32b85d9151974c75590269537470fc55">salva</a> </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structdesc__sequenza.html">desc_sequenza</a> &amp;&#160;</td>
          <td class="paramname"><em>s</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char&#160;</td>
          <td class="paramname"><em>nome</em>[]&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<div class="fragment"><pre class="fragment">{
    ofstream f(nome) ;
    
    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0 ; i &lt; s.<a class="code" href="structdesc__sequenza.html#aa7af6c1778d572702a5215e109c3f593">num_elem</a> ; i++) {
        assert(s.<a class="code" href="structdesc__sequenza.html#a20248858c97b303f76cd8ec6f3f9c00c">elementi</a>[i] != 0) ;
        <a class="code" href="manip__stampa_8cc.html#a2dad0010e500c42f05ae58bff0ca0b76">stampa_elem</a>(*s.<a class="code" href="structdesc__sequenza.html#a20248858c97b303f76cd8ec6f3f9c00c">elementi</a>[i], f);
    }
}
</pre></div>
</div>
</div>
</div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>Tutto</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classi</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>File</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Funzioni</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variabili</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Ridefinizioni di tipo (typedef)</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Tipi enumerati (enum)</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Valori del tipo enumerato</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Definizioni</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generato Gio 9 Mag 2013 12:04:52 per Generazione sequenze da &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
